#include <mockcpp/mockcpp.hpp>

#include <testngpp/testngpp.hpp>
#include <Volume.h>
#include <Length.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Volume)
{
        TEST(1 OZ should equal 2 TBSP)
        {
            	ASSERT_EQ(Volume(1, OZ), Volume(2, TBSP));   
        }

        TEST(1 OZ should not equal 4 TSP)
        {
            	ASSERT_NE(Volume(1, OZ), Volume(4, TSP));
        }

        TEST(1 TBSP should equal 3 TSP)
        {
            	ASSERT_EQ(Volume(1, TBSP), Volume(3, TSP));
        }

        TEST(1 TBSP should not equal 6 TSP)
        {
            	ASSERT_NE(Volume(1, TBSP), Volume(6, TSP));
        }

        TEST(1 OZ should equal 2*3 TSP)
        {
            	ASSERT_EQ(Volume(1, OZ), Volume(2*3, TSP));
        }

        TEST(1 OZ should not equal 2*4 TSP)
        {
            	ASSERT_NE(Volume(1, OZ), Volume(2*4, TSP));
        }

        TEST(should be able to compare OZ + TSP volume: 1 oz + 9 tsp = 15 tsp)
        {
                ASSERT_EQ(Volume(1, OZ) + Volume(9, TSP), Volume(15, TSP));
        }

        TEST(should be able to compare TSP + TBSP volume: 10 tsp + 9 tbsp = 37 tsp)
        {
                ASSERT_EQ(Volume(10, TSP) + Volume(9, TBSP), Volume(37, TSP));
        }
#if 0
	//abnormal cases bellow
        TEST(should not  be able to add  tsp  unit and yard unit: 2 tsp + 1 yard)
        {
		Volume size1(2,TSP);
		Length size2(1,YARD);
		bool a = (size2 == size1);
                Volume size3 = size1 + size2;
        }
#endif
};

FIXTURE(TestPrintMode0, "Print MODE 0")
{
        TEST("should be able to display like '1 Oz 1 Tbsp' for 3 TBSP")
        {
                Volume vol(3,TBSP);
                ASSERT_TRUE("1 Oz 1 Tbsp" == vol.print());
        }

        TEST("should be able to display like '1 Tbsp 1 Tsp' for 4 Tsp")
        {
                Volume vol(4,TSP);
                ASSERT_TRUE("1 Tbsp 1 Tsp" == vol.print());
        }

        TEST("should be able to display like '1 Oz' for 6 Tsp")
        {
                Volume vol(6,TSP);
                ASSERT_TRUE("1 Oz" == vol.print());
        }

        TEST("should be able to display like '1 Oz 1 Tsp' for 7 Tsp")
        {
                Volume vol(7,TSP);
                ASSERT_TRUE("1 Oz 1 Tsp" == vol.print());
        }

        TEST("should be able to display like '1 Oz 1 Tbsp Tsp' for 10 Tsp")
        {
                Volume vol(10,TSP);
                ASSERT_TRUE("1 Oz 1 Tbsp 1 Tsp" == vol.print());
        }

        TEST("should be able to display like '1 Tbsp' for 3 Tsp")
        {
                Volume vol(3,TSP);
                ASSERT_TRUE("1 Tbsp" == vol.print(PRINT_MODE0));
        }

        TEST("should be able to display like '0 Tsp' for 0 Oz")
        {
                Volume vol(0,OZ);
                ASSERT_TRUE("0 Tsp" == vol.print(PRINT_MODE0));
        }

        TEST("should be able to display like '60 Tsp' for 10 Oz")
        {
                Volume vol(10,OZ);
                ASSERT_TRUE("60 Tsp" == vol.print(PRINT_MODE1));
        }
};

FIXTURE(TestPrintMode1, "Print MODE 1")
{
        TEST("should be able to display like '30 Tsp' for 10 Tbsp")
        {
                Volume vol(10,TBSP);
                ASSERT_TRUE("30 Tsp" == vol.print(PRINT_MODE1));
        }

        TEST("should be able to display like '6000 Oz' for 1000 Oz")
        {
                Volume vol(1000,OZ);
                ASSERT_TRUE("6000 Tsp" == vol.print(PRINT_MODE1));
        }

        TEST("should be able to display like '0 Tsp' for 0 Oz")
        {
                Volume vol(0,OZ);
                ASSERT_TRUE("0 Tsp" == vol.print(PRINT_MODE1));
        }
};
